package com.net.xpay.core.helper;

import com.google.common.base.Strings;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 2020/10/9 14:44

 * 转账错误提示转换器
 */
@Component
public class PayTransErrorMsgHelper {

    private static Map<String/*errorCode*/, String> ERROR_MSG_MAP = new HashMap<>();

    static {
        ERROR_MSG_MAP.put("RELEASE_USER_FORBBIDEN_RECIEVE", "支付宝手机号二次放号禁止收款");
    }

    public String getErrorMsg(String errorCode, String defaultMsg) {
        if (Strings.isNullOrEmpty(errorCode)) {
            return defaultMsg;
        }

        String errMsg = ERROR_MSG_MAP.get(errorCode);
        if (Strings.isNullOrEmpty(errMsg)) {
            return defaultMsg;
        }

        return errMsg;
    }


}
